<template>
  <div>
    <div class="type-container">
      <div class="title">博客分类</div>
      <div v-for="(item, i) in typeList" :key="item.typeId" class="type-list">
        <a-divider v-if="i !== 0" />
        <router-link :to="'/blogList/'+item.typeId" class="type-item">
          <span class="type-item" v-text="item.typeName" />(<span v-text="item.typeBlogCount" />)
        </router-link>
      </div>
    </div>
  </div>
</template>
<script>
import typeApi from '@/api/type'
export default {
  data() {
    return {
      typeList: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      typeApi.getList().then(resp => {
        this.typeList = resp.data
      })
    }
  }
}
</script>
<style scoped>
.type-container {
  background-color: #fff;
  padding: 25px 20px;
}
.type-list {
  display: flex;
  flex-direction: column;
  margin-left: 30px;
  margin-right: 30px;
}
.title {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 45px;
}
.type-item {
  color: black;
  font-size: 16px;
  margin-right: 10px;
}
</style>
